<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>lagou manage</title>
<meta name="description" content="拉勾数据">
<meta name="keywords" content="二手房 房产经济 房企 开发商 拉勾数据 IFS">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed"
	href="assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="eosms for IFS" />
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<link rel="stylesheet" href="assets/css/admin.css">
</head>
<body>
	<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

	<jsp:include page="/manage_header.do" flush="true" />

	<div class="am-cf admin-main">
		<!-- sidebar start -->
		<jsp:include page="/manage_tree.do" flush="true"></jsp:include>
		<!-- sidebar end -->

		<!-- content start -->
		<div class="admin-content">

			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">呼叫任务</strong> / <small>jobitem_call</small>
				</div>
			</div>
			
			<input type="hidden" name="id" id="id" value="${ jobitem_call.id }"> <input
				type="hidden" name="status" id="status" value="${jobitem_call.adminuser.id }">
			<input type="hidden" name="page_num" id="page_num" value="0">
			<div class="am-tabs am-margin" data-am-tabs>
			
				<ul class="am-tabs-nav am-nav am-nav-tabs">
					<li class="am-active"><a href="#tab1">详细信息</a></li>
				</ul>


				<div class="am-tabs-bd">
					<div class="am-tab-panel am-fade am-in am-active" id="tab1">
						<table class="am-table am-table-striped am-table-hover table-main">
							<tr>
							<td width="33%">发布人：${jobitem_call.jobitem.job.user.name}</td>
								<td width="33%">发布时间：${jobitem_call.jobitem.job.create_time}</td>
								<td width="33%">工作类型：<c:if
										test="${jobitem_call.jobitem_type==1 }">接单提醒</c:if> 
										<c:if test="${jobitem_call.jobitem_type==2}">开工提醒</c:if>
											<c:if test="${jobitem_call.jobitem_type==3}">返工提醒</c:if></td>
							</tr>
							<tr>
								<td width="33%">装修类型：<c:if
										test="${ jobitem_call.jobitem.job.decoration_type == 1 }">毛坯装修</c:if> <c:if
										test="${jobitem_call.jobitem.job.decoration_type == 2 }">旧房改造</c:if></td>
								<td colspan="2">详细地址：${jobitem_call.jobitem.job.address }${jobitem_call.jobitem.job.community} ${jobitem_call.jobitem.job.building}栋
									${jobitem_call.jobitem.job.cell}单元 ${jobitem_call.jobitem.job.number}号</td>
							</tr>
						</table>
						<c:if test="${jobitem_call.jobitem_type==1 }">
						<table id="data_table"
							class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-title" width="20%">工长姓名</th>
									<th class="table-title" width="20%">性别</th>
									<th class="table-title" width="20%">手机号</th>
								</tr>
							</thead>
							<tbody id="data_tbody">
								
									<tr class="tr_click">
										<td>${readylist.name}（有人接单，提醒工长）</td>
										<td>${readylist.sex}</td>
										<td>${readylist.phone}（拨打）</td>
									</tr>
								
							</tbody>
						</table>
						<table id="data1_table"
							class="am-table am-table-striped am-table-hover table-main">
							<thead>
							<tr><td><strong>接单人列表</strong></td></tr>
								<tr>
									<th class="table-title" width="20%">接单人姓名</th>
									<th class="table-title" width="12%">性别</th>
									<th class="table-title" width="15%">接单的工种</th>
									<th class="table-title" width="20%">手机号</th>
									<th class="table-title" width="33%"></th>
								</tr>
							</thead>
							<tbody id="data_tbody">
								<c:forEach var="alllist" items="${alllist}" varStatus="s">
									<tr class="tr_click" alllist_id="${alllist.id }">
										<td>${alllist.user.name}</td>
										<td>${alllist.user.sex}</td>
										<td>${alllist.jobitem.jobtype.name}</td>
										<td>${alllist.user.phone}</td>
										<td class="td_click" id="${alllist.id }"><button id="choosebutton${alllist.id }" class="am-btn am-btn-primary am-active">确认工人</button>（与工长联系后，帮工长确认）</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						</c:if>
						<c:if test="${jobitem_call.jobitem_type==2 }">
						<table id="data_table"
							class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-title" width="25%">接单人姓名</th>
									<th class="table-title" width="10%">性别</th>
									<th class="table-title" width="20%">电话</th>
									<th class="table-title" width="10%">接单的工种</th>
									<th class="table-title" width="35%"></th>
								</tr>
							</thead>
							<tbody id="data_tbody">
								<c:forEach var="list" items="${userlist}" varStatus="s">
									<tr class="tr_click" userlist_id="${list.id}">
										<td>${list.user.name}（工长发起开工，提醒工人）</td>
										<td>${list.user.sex}</td>
										<td>${list.user.phone}（拨打）</td>
										<td>${list.jobitem.jobtype.name}</td>
										<td class="td_click2" id="${list.id}"><button id="startbutton${list.id}" class="am-btn am-btn-primary am-active">确认开工</button>（与工人联系后，帮工人确认开工）</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						</c:if>
						<c:if test="${jobitem_call.jobitem_type==3 }">
						<table id="data_table"
							class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-title" width="25%">返工工人姓名</th>
									<th class="table-title" width="10%">性别</th>
									<th class="table-title" width="20%">电话</th>
									<th class="table-title" width="10%">接单的工种</th>
									<th class="table-title" width="35%"></th>
								</tr>
							</thead>
							<tbody id="data_tbody">
								<c:forEach var="list" items="${reworklist}" varStatus="s">
									<tr class="tr_click" reworklist_id="${list.id}">
										<td>${list.user.name}（工长发起返工，提醒工人）</td>
										<td>${list.user.sex}</td>
										<td>${list.user.phone}（拨打）</td>
										<td>${list.jobitem.jobtype.name}</td>
										<td class="td_click3" id="${list.id}"><button id="reworkbutton${list.id}" class="am-btn am-btn-primary am-active">确认返工</button>（与工人联系后，帮工人确认返工）</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						</c:if>
				
					</div>
				</div>
			</div>
			<div class="am-margin">
			 <button id="back"  class="am-btn am-btn-primary am-btn-xs">返回</button>
			
			 </div>
	

	</div>
		</div>
 	<!-- content end -->

	<a href="#" class="am-show-sm-only admin-menu"
		data-am-offcanvas="{target: '#admin-offcanvas'}"> <span
		class="am-icon-btn am-icon-th-list"></span>
	</a>

	<jsp:include page="/manage_foot.do" flush="true" />

	<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
	<!--[if (gte IE 9)|!(IE)]><!-->
	<script src="assets/js/jquery.min.js"></script>
	<!--<![endif]-->
	<script src="assets/js/amazeui.min.js"></script>
	<script src="assets/js/app.js"></script>
	<script type="text/javascript">
$(function() {
	 $("#back").click(function(){
		 location.href="<%=request.getContextPath()%>/show_add_jobitem_call.do?user_id="+$("#status").val()+"";
	 })
	$(".td_click").click(function(){
		
			$.ajax({
				contentType:"application/json",
				type : "GET",
				url : "<%=request.getContextPath()%>/ensure_user.do?jobitem_user_id="+$(this).parent().attr("alllist_id")+"&jsoncallback=?",
				dataType: "json",
				success : function(data) {
					if(data.flag=="1"){
									
			            alert("确认成功！");
			        }
			        else{
			            alert("确认失败！");
			        }
			    },
			    error :function(){
			        alert("网络连接出错！");
			    }
			});		
	})
	$(".td_click2").click(function(){
		 
			$.ajax({
				contentType:"application/json",
				type : "GET",
				url : "<%=request.getContextPath()%>/start_response.do?jobitem_user_id="+$(this).parent().attr("userlist_id")+"&jsoncallback=?",
				dataType: "json",
				success : function(data) {
					if(data.flag=="1"){
									
			            alert("确认成功！");
			        }
			        else{
			            alert("确认失败！");
			        }
			    },
			    error :function(){
			        alert("网络连接出错！");
			    }
			});		
	});
	 $(".td_click3").click(function(){
		
			$.ajax({
				contentType:"application/json",
				type : "GET",
				url : "<%=request.getContextPath()%>/start_response.do?jobitem_user_id="+$(this).parent().attr("reworklist_id")+"&jsoncallback=?",
				dataType: "json",
				success : function(data) {
					if(data.flag=="1"){
									
			            alert("确认成功！");
			        }
			        else{
			            alert("确认失败！");
			        }
			    },
			    error :function(){
			        alert("网络连接出错！");
			    }
			});		
	 })
});
</script>
</body>
</html>